import Layout from "../components/Layout"
import Default from "../components/default"

let routes = [
    {
        path: '/',
        component: Default,
        redirect: { path: '/newIndex' },
        meta: {
            title: '底层目录',
            icon: "el-icon-s-operation",
            hidden: true
        },
        children: [
            {
                path: 'newIndex',
                name: 'newIndex',
                meta: {
                    title: '回到首页',
                    icon: "el-icon-odometer"
                },
                component: () => import("../views/newIndex")
            },
            //详情
            {
                path: '/news',
                component: () => import('../views/news'),
                meta: {
                    title: '文章详情页',
                    icon: 'el-icon-view',
                    hidden: true
                },

            },
            {
                path: '/test',
                component: () => import('../views/test'),
                meta: {
                    title: '文章详情页',
                    icon: 'el-icon-view',
                    hidden: true
                },

            },
        ],
    },



    {
        path: '/adminhome',
        component: Layout,
        meta: {
            title: '管理',
            icon: 'el-icon-chat-line-round'
        },
        children: [
            {
                path: 'homepage',
                meta: {
                    title: '主页',
                    icon: 'el-icon-document'
                },

                component: () => import('../components/Homepage') // 异步加载
            },
            {
                path: 'notice',
                meta: {
                    title: '通知',
                    icon: 'el-icon-bell'
                },
                component: () => import('../components/Notice')
            },
            {
                path: 'article',
                name: 'article',
                meta: {
                    title: '文章管理',
                    icon: 'el-icon-house'
                },
                component: () => import('../components/Article'),

            },
            {
                path: 'users',
                meta: {
                    title: '用户管理',
                    icon: 'el-icon-star-off'
                },
                component: () => import('../views/users')
            }
        ],
    },
    {
        path: '/log',
        component: Layout,
        redirect: { path: '/log/auditinfo' },
        meta: {
            title: '系统日志',
            icon: 'el-icon-coin',
            hidden: true,
        },
        children: [
            {
                path: 'auditinfo',
                name: 'auditinfo',
                meta: {
                    title: '审计日志',
                    icon: 'el-icon-coin',
                },
                component: () => import('../views/log'),
            },
        ],
    },

    //用户登录
    {
        path: '/login',
        component: () => import('../views/login'),
        meta: {
            title: '登录界面',
            icon: 'el-icon-view',
            hidden: true
        },

    },
    //注册
    {
        path: '/register',
        component: () => import('../views/register'),
        meta: {
            title: '注册界面',
            icon: 'el-icon-view',
            hidden: true
        },

    },
    
    //管理员登录
    {
        path: '/loginBack',
        component: () => import('../views/loginBack'),
        meta: {
            title: '管理员登录界面',
            icon: 'el-icon-view',
            hidden: true
        },

    },

    //用户修改密码
    {
        path: '/changePassWd',
        component: () => import('../views/changePasswd'),
        meta: {
            title: '修改密码',
            icon: 'el-icon-view',
            hidden: true
        },

    },
    
    
    //用户修改密码
    {
        path: '/newIndex',
        component: () => import('../views/newIndex'),
        meta: {
            title: '修改密码',
            icon: 'el-icon-view',
            hidden: true
        },

    },
    //公司动态
    {
        path: '/gognsi',
        component: () => import('../views/gongsi'),
        meta: {
            title: '公司动态',
            icon: 'el-icon-view',
            hidden: true
        },

    },
]
export default routes

//异步加载组件的意义
//减少打包的结果，会将异步组件分开打包，会采用异步的方式加载组件，可以有效解决组件过大的问题
//当用到这个组件时才会进行渲染